package com.lv.service.room.helper

import androidx.room.TypeConverter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.lv.service.bean.TelSecondBean
import com.lv.service.bean.TelSecondCategoryBean

/**
 * 作者： ygx
 * 创建日期：2022/7/28 10:57 PM
 * 签名： 天行健，君子以自强不息；地势坤，君子以厚德载物。
 * -    _              _           _     _   ____  _             _ _
 * -   / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
 * -  / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
 * - / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
 * -/_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
 *
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 *
 */
class InspectionLocationConverter {
    @TypeConverter
    fun stringToObject(value: String): List<TelSecondBean> {
        val listType = object : TypeToken<List<TelSecondBean>>() {}.type
        return Gson().fromJson(value, listType)
    }

    @TypeConverter
    fun objectToString(list: List<TelSecondBean>): String {
        val gson = Gson()
        return gson.toJson(list)
    }

}
class InspectionLocationReceiptConverter {
    @TypeConverter
    fun stringToObject(value: String): List<TelSecondCategoryBean> {
        val listType = object : TypeToken<List<TelSecondCategoryBean>>() {}.type
        return Gson().fromJson(value, listType)
    }

    @TypeConverter
    fun objectToString(list: List<TelSecondCategoryBean>): String {
        val gson = Gson()
        return gson.toJson(list)
    }

}